<!DOCTYPE html> 
<html lang="ja"> 
    <head> 
        <meta charset="utf-8"> 
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>DOMElement Attribute Test | TM Lib</title>
        
        <style>
            body { font-family: "Meiryo", "メイリオ", "ヒラギノ角ゴ Pro W3", sans-serif; }
            
            #content {
                display: -webkit-box;
                display: -moz-box;
                display: -o-box;
                display: box;
            }
            
            #content>* {
                padding: 10px 20px;
                width: 50%;
                -webkit-box-sizing: border-box;
                -moz-box-sizing: border-box;
                -o-box-sizing: border-box;
                box-sizing: border-box;
            }
            
            #console {
                padding: 5px;
                border: 1px solid black;
            }
            
            #box-list {
                display: -webkit-box;
                display: -moz-box;
                display: -o-box;
                display: box;
            }
            
            .box {
                width: 100px;
                height: 100px;
                margin: 10px;
                padding: 10px;
                border: 1px solid black;
                background-color: white;
                box-shadow: 2px 2px 4px 0px #aaa;
                -webkit-user-select: none;
                
                color: black;
                text-shadow: 1px 1px 2px white;
                text-align: center;
                line-height: 100px;
            }
            
            #target {
                background-color: yellow;
                box-shadow: 0px 0px 16px 4px yellow;
            }
            
        </style>
        
        <script type="text/javascript" src="./../../src/tmlib.js"></script>
        <script id="test-script">
            
            TM.loadScript("dom", "dom");
            TM.loadScript("dom", "animation");
            
            /*
             * Test
             */
            TM.main(function()
            {
                // コンソール生成
                var c = TM.DebugConsole("#console");
                
                // 全てのボックスを取得
                var boxList = TM.$DOMElement().$queryAll(".box");
                c.group("before : ");
                c.log("id : ", boxList.attr.get("id"));
                c.log("id : ", boxList.attr.get("class"));
                c.groupEnd();
                
                // 1番目の id を first から target に変更
                var eFirst = TM.$id("first");
                var attr = TM.$DOMAttr(eFirst);
                attr.set("id", "target");
                
                // 2番目のクラスを取り除く
                var eSecond = TM.$id("second");
                var attr = TM.$DOMAttr(eSecond);
                attr.remove("class");       // クラスを取り除く
                
                
                // 全てのボックスを取得
                c.group("after : ");
                c.log("id : ", boxList.attr.get("id"));
                c.log("id : ", boxList.attr.get("class"));
                c.groupEnd();
            });
            
        </script>
        
        <script>
            TM.addNamespace("prettify", "./../../plugins/prettify");
            TM.loadPrettify();
            
            TM.main(function(){
                TM.$id("code").innerText = TM.$id("test-script").innerText;
                prettyPrint();
            });
        </script>
    </head>
    
    <body>
         
        <h1>DOMElement Attribute Test | TM Lib</h1>
        
        <div id="content">
            <section>
                <h2>DOMElement Test</h2>
                <section id="box-list">
                    <div id="first"  class="box">first</div>
                    <div id="second" class="box">second</div>
                    <div id="third" class="box">third</div>
                </section>
                <h2>Console</h2>
                <pre id="console"></pre>
            </section>
            <section>
                <h2>Code</h2>
                <pre id="code" class="prettyprint"></pre>
            </section>
        </div>
        
        
    </body>
</html>